package com.lapian.designmode.flyweight.my;

import java.util.HashMap;

public class DouLuoDaLuFactory {
    private HashMap<String, ConcreteRole> pool=new HashMap<>();
    public AbstractRole getRoleCategory(String type) {
        if (!pool.containsKey(type)){
            pool.put(type,new ConcreteRole(type));
        }
        return (AbstractRole) pool.get(type);
    }
    public int getRoleCount(){
        return pool.size();
    }
}
